package com.jsb.laundry.service.impl;

import com.jsb.laundry.dao.ProductDao;
import com.jsb.laundry.model.vo.LaundryPriceVo;
import com.jsb.laundry.service.ProductService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Resource
    private ProductDao productDao;

    @Override
    public List<LaundryPriceVo> findServeByGoodsId(String goodsId) {
        List<LaundryPriceVo> serveByGoodsId = productDao.findServeByGoodsId(goodsId);
        for (LaundryPriceVo laundryPriceDto : serveByGoodsId) {
            String servePrice = laundryPriceDto.getServePrice();
            double vipDiscount = laundryPriceDto.getVipDiscount();
            double v1 = Double.parseDouble(servePrice) * vipDiscount;
            laundryPriceDto.setVipPrice(String.valueOf(v1));
        }
        return serveByGoodsId;
    }


}
